package com.glsc.ngateway.common.base.domain.mysql.gateway.platform.flow;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.glsc.ngateway.common.base.domain.mysql.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.time.LocalDate;

/**
 * @author xuchang
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Entity
@Where(clause = "deleted = 0")
@SQLDelete(sql = "update t_gw_flow_form_equipment_server_apply_server_detail set deleted = UNIX_TIMESTAMP(NOW()) where id=?")
@SQLDeleteAll(sql = "update t_gw_flow_form_equipment_server_apply_server_detail set deleted = UNIX_TIMESTAMP(NOW()) where id=?")
@Table(name = "t_gw_flow_form_equipment_server_apply_server_detail")
@org.hibernate.annotations.Table(appliesTo = "t_gw_flow_form_equipment_server_apply_server_detail", comment = "设备变更流程form表单-服务器子表")
public class FlowFormEquipmentServerApplyServerDetail extends BaseEntity {

    private static final long serialVersionUID = 5916095154106557912L;

    @Column(name = "equipment_server_apply_id", columnDefinition = "bigint not null comment '主表ID'")
    private Long equipmentServerApplyId;

    @Column(name = "business_name", columnDefinition = "varchar(64) comment '业务系统'")
    private String businessName;

    @Column(name = "application_detail", columnDefinition = "varchar(64) comment '应用明细(同mx_id)'")
    private String applicationDetail;

    @Column(name = "machine_room", columnDefinition = "int comment '机房'")
    private String machineRoom;

    @Column(name = "machine_cab", columnDefinition = "varchar(64) comment '机柜'")
    private String machineCab;

    @Column(name = "machine_unit", columnDefinition = "varchar(64) comment '单位'")
    private String machineUnit;

    @Column(name = "capital_typed", columnDefinition = "varchar(100) comment '资产编号原'")
    private String capitalTyped;

    @Column(name = "capital_type", columnDefinition = "varchar(64) comment '资产编号'")
    private String capitalType;

    @Column(name = "capital_style", columnDefinition = "int comment '设备类型'")
    private String capitalStyle;

    @Column(name = "brand", columnDefinition = "int comment '品牌'")
    private String brand;

    @Column(name = "brand_type", columnDefinition = "varchar(100) comment '型号'")
    private String brandType;

    @Column(name = "pn_pid", columnDefinition = "varchar(64) comment 'PN/PID'")
    private String pnPid;

    @Column(name = "sn", columnDefinition = "varchar(100) comment 'SN'")
    private String sn;

    @Column(name = "operation_sys", columnDefinition = "int comment '操作系统'")
    private String operationSys;

    @Column(name = "disk_type", columnDefinition = "varchar(64) comment '硬盘规格'")
    private String diskType;

    @Column(name = "cpu", columnDefinition = "varchar(64) comment 'CPU'")
    private String cpu;

    @Column(name = "memory", columnDefinition = "varchar(64) comment '内存'")
    private String memory;

    @Column(name = "user_id", columnDefinition = "varchar(64) comment '责任人'")
    private String userId;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @Column(name = "cc_time", columnDefinition = "datetime comment '出厂年份'")
    private LocalDate ccTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @Column(name = "wb_time", columnDefinition = "datetime comment '维保年份'")
    private LocalDate wbTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @Column(name = "sj_time", columnDefinition = "datetime comment '上架时间'")
    private LocalDate sjTime;

    @Column(name = "plan_on", columnDefinition = "varchar(64) comment '预计使用年限'")
    private String planOn;

    @Column(name = "support_power", columnDefinition = "int comment '单/双电源'")
    private String supportPower;

    @Column(name = "bz", columnDefinition = "varchar(64) comment '备注'")
    private String bz;

    @Column(name = "machine_status", columnDefinition = "int comment '状态记录'")
    private String machineStatus;

    @Column(name = "mac1", columnDefinition = "varchar(64) comment 'MAC1'")
    private String mac1;

    @Column(name = "mac2", columnDefinition = "varchar(64) comment 'MAC2'")
    private String mac2;

    @Column(name = "mac3", columnDefinition = "varchar(64) comment 'MAC3'")
    private String mac3;

    @Column(name = "mac4", columnDefinition = "varchar(64) comment 'MAC4'")
    private String mac4;

    @Column(name = "mac5", columnDefinition = "varchar(64) comment 'MAC5'")
    private String mac5;

    @Column(name = "mac6", columnDefinition = "varchar(64) comment 'MAC6'")
    private String mac6;

    @Column(name = "mac7", columnDefinition = "varchar(64) comment 'MAC7'")
    private String mac7;

    @Column(name = "mac8", columnDefinition = "varchar(64) comment 'MAC8'")
    private String mac8;

    @Column(name = "mac9", columnDefinition = "varchar(64) comment 'MAC9'")
    private String mac9;

    @Column(name = "mac10", columnDefinition = "varchar(64) comment 'MAC10'")
    private String mac10;

    @Column(name = "mac11", columnDefinition = "varchar(64) comment 'MAC11'")
    private String mac11;

    @Column(name = "mac12", columnDefinition = "varchar(64) comment 'MAC12'")
    private String mac12;

    @Column(name = "ip1", columnDefinition = "varchar(64) comment 'IP1,关联虚拟主机IP'")
    private String ip1;

    @Column(name = "ip2", columnDefinition = "varchar(64) comment 'IP2'")
    private String ip2;

    @Column(name = "ip3", columnDefinition = "varchar(64) comment 'IP3'")
    private String ip3;

    @Column(name = "ip4", columnDefinition = "varchar(64) comment 'IP4'")
    private String ip4;

    @Column(name = "qj", columnDefinition = "varchar(64) comment '集群'")
    private String qj;

    @Column(name = "fix_record", columnDefinition = "text comment '维修记录'")
    private String fixRecord;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @Column(name = "fix_time", columnDefinition = "datetime comment '维修日期'")
    private LocalDate fixTime;

    @Column(name = "bf", columnDefinition = "varchar(64) comment '备份情况说明'")
    private String bf;

    @Column(name = "network_segment", columnDefinition = "int comment '业务网段'")
    private String networkSegment;

    @Column(name = "ilo", columnDefinition = "varchar(64) comment 'ILO'")
    private String ilo;

}
